package com.ssm.studen.service.impl;

import com.ssm.studen.dao.RolepressionDao;
import com.ssm.studen.model.Rolepression;
import com.ssm.studen.service.RolePressionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * 角色人员权限表：
 *              实现业务及流程接口当中的内容
 */
@Service
public class RolePressionServiceImpl implements RolePressionService {

    @Autowired
    private RolepressionDao rolepressionDao;


    /**
     * 角色人员权限表查询
     * @param rpnum
     * @return
     */
    @Override
    public List<Rolepression> selectRolepression(int rpnum) {
        List<Rolepression> list = rolepressionDao.selectRolepression(rpnum);
        return list;
    }


    /**
     * 角色人员权限表更新
     * @param rolepression
     * @return
     */
    @Override
    public int updateRolepression(Rolepression rolepression) {
        int isUpdate = 0;
        try {
            isUpdate = rolepressionDao.updateRolepression(rolepression);
        }catch (Exception e){
            isUpdate = -1;
            //打印更新时报错的情况
            System.out.println("更新角色人员权限信息时执行SQL报错的原因是：" + e.getMessage());
        }
        return isUpdate;
    }
}
